package Proxy

import scala.collection.mutable.ListBuffer

class Monitor {
  private val candyMachineLst: ListBuffer[CandyMachine] = ListBuffer()

  //给监控器添加一台糖果机
  def addMachine(mcm: CandyMachine): Unit = {
    candyMachineLst.append(mcm)
  }

  def report(): Unit = {
    candyMachineLst.foreach(cm => {
      println("----------------------")
      println("Machine Loc :" + cm.getLocaltion())
      println("Machine Candy count: " + cm.getCount())
      println("Machine State: " + cm.getState.getStateName())
    })
  }

}
